<template>
	<view class="">
		<view style="padding: 15px;background-color: #fff;">
			<view style="padding: 10px 0;">发票详情</view>
			<view class="">
				<text style="color: #999;">发票类型：</text>
				<text style="font-weight: bold;">{{infoData.is_tax_invoice_cn}}</text>
			</view>
			<view class="">
				<text style="color: #999;">发票抬头：</text>
				<text style="font-weight: bold;">{{infoData.invoice_title}}</text>
			</view>
			<view class="" v-if="infoData.taxpayer_number">
				<text style="color: #999;">发票税号：</text>
				<text style="font-weight: bold;">{{infoData.taxpayer_number}}</text>
			</view>
			<view class="">
				<text style="color: #999;">发票金额：</text>
				<text style="font-weight: bold;">¥{{infoData.goods_money}}</text>
			</view>
			<view class="">
				<text style="color: #999;">开票时间：</text>
				<text style="font-weight: bold;">{{infoData.invoice_time}}</text>
			</view>
		</view>
		<view style="background-color: #f5f5f5;width: 100%;height: 10px;"></view>

		<view
			style="display: flex;align-items: center;justify-content: space-between;font-weight: bold;background-color: #fff;padding:10px 15px;">
			<text>发票链接</text>
			<text style="color: #00aaff;" @click="copyUrl()">复制链接</text>
		</view>
		<!-- <view style="background-color: #fff0d3;color: #6b4f27;font-size: 12px;text-align: center;padding:5px;">
		{{$util.img(infoData.invoice_image)}}
		</view> -->
		<view style="background-color: #fff0d3;color: #6b4f27;font-size: 12px;text-align: center;padding:5px;">
			复制链接后请在浏览器中打开进行下载
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				infoData:{}
			}
		},
		onLoad(data){
			this.init(data.order_id)
		},
		methods: {
			copyUrl(){
				let url = this.$util.img(this.infoData.invoice_image)
				uni.setClipboardData({
					data: url,
					success: function () {
						uni.showToast({
							title: '链接复制成功',
							duration: 2000
						});
					}
				});
			},
			init(order_id){
				this.$api.sendRequest({
					url: '/api/order/getInvoiceDetail',
					data: {
						order_id:order_id
					},
					success: res => {
						this.infoData = res.data
					}
				})
			}
		}
	}
</script>

<style>

</style>